package behavioral.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 购物车
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class Basket {
    private List<IProduct> products = new ArrayList<IProduct>();

    public void accept(AbstractVisitor visitor) {
        for (IProduct product : products) {
            product.accept(visitor);
        }
    }

    public void addProduct(IProduct product) {
        products.add(product);
    }
}
